#include <iostream>
#include <string>
#include <stdint.h>

using namespace std;

class Solution
{
public:
    uint32_t reverseBits(uint32_t n)
    {
        uint32_t m=0;
        int j=0;
        for(int i=0; i<32; ++i)
            {
                j=n%2;
                m=m<<1;
                m+=j;
                n=n>>1;
            }
        return m;
    }
};

int main()
{
    Solution s;
    uint32_t a;
    while(true)
        {
            cin>>a;
            cout<<s.reverseBits(a)<<endl;
        }
}